import request from '@/utils/request';

/* 阿里云oss文件上传 */
export function uploadFile(file: File) {
  const formData = new FormData();
  formData.append('file', file);

  return request({
    url: '/resource/oss/upload',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: formData
  });
}
/* 删除阿里云oss文件 */
export function delFile(ossId: string | number) {
  return request({
    url: '/resource/oss/' + ossId,
    method: 'delete'
  });
}

export const uploadFileFormData = (formData: FormData) => {
  return request({
    url: '/resource/oss/upload',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: formData
  });
};
